<?php

namespace App\Http\Middleware;

use Closure;

class CrossDomain
{
	/**
	 * @param $request
	 * @param Closure $next
	 * @return mixed
	 */
	public function handle($request, Closure $next)
	{
		$response = $next($request);
		$response->header('Access-Control-Allow-Origin','*')
//			->header('Content-type','application/json')
			->header('Access-Control-Allow-Headers','Origin,Content-Type,Cookie,Accept,multipart/form-data,application/json,X-Auth-Token')
			->header('Access-Control-Allow-Methods','GET,POST,OPTIONS')
			->header('Access-Control-Allow-Credentials','false');
		return $response;
	}
}
